#include "unp.h"

int main(int argc, char **argv)
{
  int fd;
  ssize_t n;

  if (argc != 4)
  {
    printf("openfile <sockfd#> <filename> <mode>\n");
    exit(-1);
  }

  if ( (fd = open(argv[2], atoi(argv[3]))) < 0)
    exit((errno > 0) ? errno : 255);
  
  n = write_fd(atoi(argv[1]), "", 1, fd);

  if (n < 0)
    exit((errno > 0) ? errno : 255);

  exit(0);
}
